Skip to content

Migrate to new Rust Random API #590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

emmanuel-ferdman
Copy link

📝 Summary

This small PR fixes a deprecation warning by updating the usage of thread_rng() to rng() from the rand crate.

💡 Motivation and Context

The rand::thread_rng() function has been deprecated in favor of the simplified rand::rng() in newer versions of the rand crate. This change aligns the code with the latest API and eliminates compiler warnings:

warning: use of deprecated function `rand::thread_rng`: renamed to `rng`
   --> crates/op-rbuilder/src/generator.rs:423:15
    |
423 |     use rand::thread_rng;
    |               ^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated function `rand::thread_rng`: renamed to `rng`
   --> crates/op-rbuilder/src/generator.rs:610:23
    |
610 |         let mut rng = thread_rng();
    |                       ^^^^^^^^^^

See more details here.

✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

Signed-off-by: Emmanuel Ferdman <[email protected]>
@ferranbt
Copy link
Collaborator

Hey, do you mind opening the PR in https://github.com/flashbots/op-rbuilder?

@ferranbt ferranbt closed this May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants